﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FCT551.Base;
using System.Xml.Serialization;
using System.IO;

namespace FCT551.Models
{
    [XmlRoot("系统配置")]
    [Serializable]
    public class Config : NotifyPorperChanged, ICloneable
    {
        private bool isUse;

        /// <summary>
        /// 是否启用
        /// </summary>
        [XmlElement("是否启用")]
        public bool IsUse
        {
            get
            {
                return isUse;
            }
            set
            {
                isUse = value;
                this.SetProperty();
            }
        }

        private int _configid;

        /// <summary>
        /// 配置id
        /// </summary>
        [XmlElement("配置id")]
        public int Configid
        {
            get
            {
                return _configid;
            }
            set
            {
                _configid = value;
                this.SetProperty();
            }
        }

        private int _maxSationNums;

        /// <summary>
        /// 配置id
        /// </summary>
        [XmlElement("最大工位数")]
        public int MaxStationNums
        {
            get
            {
                return _maxSationNums;
            }
            set
            {
                _maxSationNums = value;
                this.SetProperty();
            }
        }

        private string configName;
        /// <summary>
        /// 配置名称
        /// </summary>

        [XmlElement("配置名称")]
        public string ConfigName
        {
            get
            {
                return configName;
            }
            set
            {
                configName = value;
                this.SetProperty();
            }
        }

        private string firstCode;

        /// <summary>
        /// 前缀二维码
        /// </summary>
        [XmlElement("前缀二维码")]
        public string FirstCode
        {
            get
            {
                return firstCode;
            }
            set
            {
                firstCode = value;
                this.SetProperty();
            }
        }

        private int port;
        /// <summary>
        /// 设备端口号
        /// </summary>

        [XmlElement("Mes端口号")]
        public int Port
        {
            get
            {
                return port;
            }
            set
            {
                port = value;
                this.SetProperty();
            }
        }

        private string mesaddress;
        /// <summary>
        ///  mes地址
        /// </summary>

        [XmlElement("Mes地址")]
        public string Mesaddress
        {
            get
            {
                return mesaddress;
            }
            set
            {
                mesaddress = value;
                this.SetProperty();
            }
        }

        private bool ismes;

        /// <summary>
        /// 是否启用Mes
        /// </summary>
        [XmlElement("是否启用Mes")]
        public bool IsMes
        {
            get
            {
                return ismes;
            }
            set
            {
                ismes = value;
                this.SetProperty();
            }
        }

        private bool isngtomes;

        /// <summary>
        /// 是否启用NG确认上传MES
        /// </summary>
        [XmlElement("是否启用NG确认上传MES")]
        public bool IsNGToMes
        {
            get
            {
                return isngtomes;
            }
            set
            {
                isngtomes = value;
                this.SetProperty();
            }
        }

        private bool isNGReTest;

        /// <summary>
        /// NG项是否复测
        /// </summary>
        [XmlElement("NG项是否复测")]
        public bool IsNGReTest
        {
            get
            {
                return isNGReTest;
            }
            set
            {
                isNGReTest = value;
                this.SetProperty();
            }
        }

        private string _pathMothedaPath;
        /// <summary>
        /// 测试方法地址
        /// </summary>

        [XmlElement("测试方法地址")]
        public string PathMothedaPath
        {
            get
            {
                return _pathMothedaPath;
            }
            set
            {
                _pathMothedaPath = value;
                this.SetProperty();
            }
        }

        private string _procdutImagePath;
        /// <summary>
        /// 测试方法地址
        /// </summary>

        [XmlElement("产品图片地址")]
        public string ProcdutImagePath
        {
            get
            {
                return _procdutImagePath;
            }
            set
            {
                _procdutImagePath = value;
                this.SetProperty();
            }
        }

        private Command _selectFileCommand;

        [XmlIgnore] // 此属性不会被序列化,选择测试文件地址
        public Command SelectFileCommand
        {
            get
            {
                return _selectFileCommand;
            }
            set
            {
                _selectFileCommand = value;
                this.SetProperty();
            }
        }

        private Command _selectImageCommand;

        [XmlIgnore] // 此属性不会被序列化，选择产品图片地址
        public Command SelectImageCommand
        {
            get
            {
                return _selectImageCommand;
            }
            set
            {
                _selectImageCommand = value;
                this.SetProperty();
            }
        }

        /// <summary>
        /// 克隆方法，添加新配置项的时候要加！
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            return new Config
            {
                MaxStationNums = this.MaxStationNums,
                Configid = this.Configid,
                IsUse = this.IsUse,
                ConfigName = this.ConfigName,
                FirstCode = this.FirstCode,
                Port = this.Port,
                Mesaddress = this.Mesaddress,
                IsMes = this.IsMes,
                PathMothedaPath = this.PathMothedaPath,
                SelectFileCommand = this.SelectFileCommand,
                SelectImageCommand = this.SelectImageCommand,
                ProcdutImagePath = this.ProcdutImagePath,
                IsNGReTest = this.IsNGReTest,
                IsNGToMes = this.IsNGToMes
                            };
        }
    }
}